import  smtplib
from email.mime.text import MIMEText
from email.header import Header
#发送邮件主题
subject = "python email test "
#编写HTML类型邮件正文
msg = MIMEText("<html><h1>你好啊，王海成 坤 ！ </h1></html>","html","utf-8")
msg["subject"] = Header(subject,"utf-8")

#发送邮件
smtp = smtplib.SMTP()
smtp.connect("smtp.163.com")
smtp.login("18793637427@163.com","whc5201314")
smtp.sendmail("18793637427@163.com","18793637427@163.com",msg.as_string())
smtp.quit()